<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
  <title><spring:message code="sys.dict.title" /></title>
  <meta name="decorator" content="grid-select"/>
</head>
<body title="<spring:message code="sys.dict.title" />">
<grid:grid id="groupGridId" url="${adminPath}/sys/user/ajaxListConfig?gid=${user.id}" scrollpage="true" pageable="false" >
	<grid:column label="sys.common.key" hidden="true"   name="id" width="100"/>
	<grid:column label="sys.common.key" hidden="true"   name="organization.id" width="100"/>
	<grid:column label="sys.common.key" hidden="true"   name="user.id" width="100"/>
	<%-- <grid:column label="sys.common.opt"  name="opt" formatter="button" width="70"/>
	<grid:button title="sys.user.role"  groupname="opt" function="updateObj" outclass="btn-primary" winwidth="300px"  innerclass="fa-user" url="${adminPath}/sys/user/authRole" />
	<grid:button title="sys.user.per"   groupname="opt" function="updateObj" outclass="btn-info"    winwidth="300px"  innerclass="fa-key" url="${adminPath}/sys/user/authMenu" /> --%>
	<%-- <grid:button   groupname="opt" function="delete"  url="${adminPath}/sys/user/{id}/deleteOrg"/> --%>
	<grid:column label="sys.user.realname"  name="user.realname"  width="50"/>
   	<grid:column label="sys.organization.code"  name="organization.code" width="50"/>
	<grid:column label="sys.organization.name"  name="organization.name" width="120"/>
    <grid:column label="sys.organization.type"  name="organization.type"  dict="orggroup" width="50"/>
	<grid:toolbar  function="updateObj" outclass="btn-primary" winwidth="300px" icon="fa-plus" title="添加组织" url="${adminPath}/sys/user/authOrg?gid=${user.id}"  />
	<grid:toolbar  function="delete"   url="${adminPath}/sys/user/batch/deleteOrg" />
	<grid:toolbar  function="setRole" title="sys.user.role" winwidth="300px" icon="fa-user" url="${adminPath}/sys/user/authRole" />
	<grid:toolbar  function="setOrg"  title="sys.user.per" winwidth="300px" icon="fa-key" url="${adminPath}/sys/user/authMenu" />
	<%-- <grid:toolbar  function="search"  />
	<grid:toolbar  function="reset"  /> --%>

</grid:grid>
<script type="text/javascript">

/**
 * @function 批量分配角色权限.<br> 
 * @author zcg .<br> 
 * @date 2018/4/27 .<br>
 */
function setRole(title,url,gridId,width, height){
	var rows =$("#"+gridId).jqGrid('getGridParam','selarrrow');
	if(rows.length==0){
		layer.msg('请选择数据', {icon: 3,shade:0.3});
		return;
	}
	var ids = rows.join(',');
	url = url+"?id="+ids;
	openDialog(title,url,gridId,width, height);
}

/**
 * @function 批量分配组织权限.<br> 
 * @author zcg .<br> 
 * @date 2018/4/27 .<br>
 */
function setOrg(title,url,gridId,width, height){
	var rows =$("#"+gridId).jqGrid('getGridParam','selarrrow');
	if(rows.length==0){
		layer.msg('请选择数据', {icon: 3,shade:0.3});
		return;
	}
	var ids = rows.join(',');
	url = url+"?id="+ids;
	openDialog(title,url,gridId,width, height);
}

</script>
</body>
</html>